#! /bin/bash
### BEGIN INIT INFO
# Provides:          FREQBOT
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Should-Start:      $local_fs
# Should-Stop:       $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts freQ-bot
# Description:       starts freQ Jabber Bot 
### END INIT INFO

export PATH=/sbin:/bin:/usr/sbin:/usr/bin

. /lib/lsb/init-functions

NAME=freqbot
DESC="freQ Jabber bot"

USER=freqbot
TOOL=/usr/sbin/freqtool

case "$1" in
start)
	su ${USER} -s /bin/sh -c "${TOOL} start"
	;;
stop)
	su ${USER} -s /bin/sh -c "${TOOL} stop"
	;;
reload|force-reload)
	su ${USER} -s /bin/sh -c "${TOOL} stop"
        su ${USER} -s /bin/sh -c "${TOOL} start"
	;;
restart)
	su ${USER} -s /bin/sh -c "${TOOL} stop"
        su ${USER} -s /bin/sh -c "${TOOL} start"
	;;
*)
	echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2
	exit 1
	;;
esac

exit 0

